<!--_meta 作为公共模版分离出去-->
<include file='public/_meta'>
<!--/meta 作为公共模版分离出去-->

<title>车辆取回</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<article class="page-container">
	<form action="{:url('index/off/edit')}" method="post" class="form form-horizontal" id="form-member-add" enctype="multipart/form-data">
		<input type="hidden" name="id" value="{$data.id}">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>车牌号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="car_sn" value="{$data.car_sn}" disabled>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>车架号 : </label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="car_unique_id" value="{$data.car_unique_id}" disabled>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">上次离线原因：</label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<input type="text" class="input-text" value="{$datum.reason}" disabled>
			</div>
		</div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">
                <span class="c-red">*</span>
                离线原因 :</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:150px;">
                    <select class="select" name="type" size="1" id="reason">
                    	<option value="">请选择</option>
                       	<option value="2">长租拆设备</option>
                       	<option value="3">维修</option>
                       	<option value="4">整备待上架</option>
                       	<option value="5">违章下架</option>
                       	<option value="6">自测试用</option>
                       	<option value="7">门店展车</option>
                       	<option value="8">其他</option>
                    </select>
                </span>
            </div>
        </div>		
		<div class="row cl" id="rest" style="display: none">
			<label class="form-label col-xs-4 col-sm-3">其他 : </label>
			<div class="formControls col-xs-8 col-sm-9"> 
				<textarea class="textarea" name="reason"></textarea>
			</div>
		</div>
		<div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">
                <span class="c-red">*</span>
                免提醒 :</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box" style="width:100px;">
                    <select class="select" name="time" size="1">
                    	<option value="">请选择</option>
                      	<option value="3">3天</option>
                       	<option value="5">5天</option>
                       	<option value="7">7天</option>
                       	<option value="15">15天</option>
                       	<option value="30">30天</option>
                       	<option value="60">60天</option>
                       	<option value="365">1年</option>
                    </select>
                </span>
            </div>
        </div>		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-success radius" type="submit" value="&nbsp;&nbsp;确认提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
<!--_footer 作为公共模版分离出去-->
<include file='public/_footer'>
<!--/_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-member-add").validate({
		rules:{
			reason:{
				required:true,
			},
			time:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success: function(data) { 
				 	var index = parent.layer.getFrameIndex(window.name);
					//parent.$('.btn-refresh').click();
	                if(data['code']==0){
	                
	                	layer.msg(data['msg'], {icon:6,time:1000},function(){

							parent.location.href = '{:url('abnormal')}';              		
							parent.layer.close(index);
	                	});

	                }else{
	                	layer.msg(data['msg']);

	                }
	            }
			});
		}
	});

	$("#reason").change(function(){
		let obj = $("#reason option:selected");
		if(obj.val() == 8){
			$("#rest").css("display","block");
		}else{
			$("#rest").css("display","none");
		}
	})

});

function maxDate(){
	var datemin = $('#datemin').val();
 	date = this.randomDate();
	$('#datemax').attr('value',date);
	
}

function minDate(){
	var datemax = $('#datemax').val();
	var timestamp = Date.parse(datemax);
	var date = new Date(timestamp-7200*1000);
	Y = date.getFullYear() + '-';
        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        D = date.getDate() + ' ';
        h = date.getHours() + ':';
        m = date.getMinutes() + ':';
        s = date.getSeconds();
        date = Y+M+D+h+m+s;
        $('#datemin').attr('value',date);
}
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>